package com.methods;

/**
 * 水果类
 * 2017/8/16
 * @author Erik
 * @version 0.1
 * @since JDK1.8.
 */
public class Fruits {

    String shape;
    String tases;

    public Fruits(){}

    public Fruits(String shape,String tases){
        this.setShape(shape);
        this.setTases(tases);
    }

    //setters
    public void setShape(String shape)  {       this.shape=shape;       }
    public void setTases(String tases)  {       this.tases=tases;       }

    //getters
    public String getShape()    {   return this.shape;  }
    public String getTases()    {   return this.tases;  }

    public void eat(){
        System.out.println("水果可供人们食用");
    }

    public boolean  equals(Object fruit1){
        if(fruit1==null)    return false;

        Fruits temp=(Fruits) fruit1;

        if(this.getTases().equals(temp.getTases()) &&
                this.getShape().equals(temp.getShape()))
            return true;
        else
            return false;
    }

}
